library(here)
library(galah)
library(skimr)
library(dplyr)
library(lubridate)
library(stringr)
library(ggplot2)
library(leaflet)
library(leaflet.extras)
library(reactable)
library(scico)
reptilia <- readRDS(here("data", "reptilia"))

reptilia_tidy <- reptilia %>% 
  filter(cl22 == "Australian Capital Territory") %>% 
  rename(state = cl22, 
         forestType = cl10902) %>% 
  mutate(forestType = na_if(forestType, ""),
         basisOfRecord = tolower(basisOfRecord),
         basisOfRecord = str_replace(basisOfRecord, "_", " "),
         eventDate = as_datetime(eventDate, tz = "Australia/Sydney", format = NULL),
         eventDate = as_date(eventDate, tz = NULL),
         month = month(eventDate))
skim(reptilia_tidy)
Data summary
Name reptilia_tidy
Number of rows 10145
Number of columns 12
_______________________
Column type frequency:
character 8
Date 1
numeric 3
________________________
Group variables None

Variable type: character

skim_variable n_missing complete_rate min max empty n_unique whitespace
scientificName 0 1 4 33 0 102 0
genus 0 1 0 16 106 52 0
family 0 1 0 15 38 12 0
order 0 1 0 10 4 3 0
dataResourceName 0 1 9 87 0 23 0
basisOfRecord 0 1 7 18 0 5 0
state 0 1 28 28 0 1 0
forestType 17 1 6 31 0 10 0

Variable type: Date

skim_variable n_missing complete_rate min max median n_unique
eventDate 5206 0.49 1954-01-22 2021-11-25 2012-10-08 1783

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
decimalLatitude 0 1.00 -35.34 0.15 -35.91 -35.40 -35.3 -35.24 -35.12 ▁▁▃▇▇
decimalLongitude 0 1.00 149.11 0.30 148.76 148.99 149.1 149.15 150.77 ▇▂▁▁▁
month 5206 0.49 7.92 3.92 1.00 3.00 10.0 11.00 12.00 ▃▁▁▂▇
# remove cols not of interest in a table
reptilia_subset <- reptilia_tidy %>% 
  select(eventDate:basisOfRecord, forestType)

reactable(
  reptilia_subset,
  columns = list(
    eventDate = colDef(name = "Date"),
    scientificName = colDef(name = "Species"),
    genus = colDef(name = "Genus"),
    family = colDef(name = "Family"),
    order = colDef(name = "Order"),
    dataResourceName = colDef(name = "Source"),
    basisOfRecord = colDef(name = "Record type"),
    forestType = colDef(name = "Forest type")
  ),
  showSortable = TRUE,
  filterable = TRUE,
  searchable = TRUE,
  showPageInfo = FALSE,
  striped = TRUE
)

Citation

ALA occurrence download https://doi.org/10.26197/ala.1999d964-1ccc-44f5-8cba-ed7ec33b1e41. Accessed from R with galah 1.3.1 (https://github.com/AtlasOfLivingAustralia/galah/) on 2021-12-04.